<extend name="Public/base" />
<block name="content">
<div id="content">
	<div id="content-header">
		<div id="breadcrumb">
			<a href="{:U('Index/index')}" title="首页" class="tip-bottom"><i class="icon-home"></i> 首页</a> 
			<a href="#" class="current">{$meta_title}</a>
		</div>
	</div>
	<div class="container-fluid">
		<br/>
		<div class="search-form cf">
			<div class="sleft">
				<form autocomplete="off">
					<span class="control-group">
						<select class="form-control" style="width: 150px;" name="activity_id" id="activity_id" onchange="change_merchant(activity_id, '{:U('Shop/getActivityMerchant')}')">
							<option value=0>选择活动</option>
							<volist name="activity_list" id="vo">
								<option value='{$vo.activity_id}'>{$vo.activity_name|strip_tags}</option>
							</volist>
							{$Think.config.ACTIVITY_TTTM}
						</select>
					</span>
					<span class="control-group">
						<select class="form-control" style="width: 180px;" name="merchant_id" id="merchant_id" onchange="change_shop(activity_id,merchant_id, '{:U('Shop/getMerchantShop')}')">
							<option value=0>选择商户</option>
							<volist name="merchant_list" id="vo">
								<option value='{$vo.merchant_id}'>{$vo.merchant_name|strip_tags}</option>
							</volist>
						</select>
					</span>
					<span class="control-group">
						<select class="form-control" style="width: 150px;" name="shop_id" id="shop_id">
							<option value=0>选择店铺</option>
							<volist name="shop_list" id="vo">
								<option value='{$vo.shop_id}'>{$vo.shop_name|strip_tags}</option>
							</volist>
						</select>
					</span>
					<span class="control-group">
						<select class="form-control" style="width: 150px;" name="order_status" id="order_status">
							<option value=100>订单状态</option>
							<volist name="Think.config.ORDER_STATUS" id="vo_status">
								<option value='{$key}'>{$vo_status}</option>
							</volist>
						</select>
					</span>
		      		<input type="text" id="apply_start_time" name="apply_start_time" readonly="readonly" class="datepicker" value="{:strip_tags(I('apply_start_time'))}" placeholder="申请核销开始时间" >
		      		<input type="text" id="apply_end_time" name="apply_end_time" readonly="readonly" class="datepicker" value="{:strip_tags(I('apply_end_time'))}" placeholder="申请核销结束时间" >
					<button type="button" id="a_time" class="btn btn-warning">清除</button>
					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
					<button class="btn btn-primary" type="button" id="search_count" onclick="$('form').submit()"><i class="icon-search icon-white"></i> 搜索</button>　<img id="loading" style="display:none;" src="__IMG__/loading.gif">
				</form>
			</div>
		</div>
		<div class="row-fluid">
			<div class="span12">
				<div class="widget-box">
					<div class="widget-content ">
						<table id="count_table" style="display:none;" class="table table-bordered table-striped">
							<thead>
								<tr>
									<th>店铺</th>
									<th>申诉数量</th>
									<th>申请识别码数量</th>
									<th>申请核销数量</th>
									<th>回访数量</th>
									<th>已补尾款</th>
									<th>未补尾款</th>
									<th>商家已退</th>
									<th>不清除</th>
									<th>没买过</th>
									<th>未接、停机</th>
									<th>其他</th>
									<th>不合格次数</th>
									<th>活动</th>
								</tr>
							</thead>
							<tbody id="count_content"></tbody>
						</table>
						<center id="null_table">暂无数据</center>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(function (){
	
	//clear
	$('#a_time').click(function(){
		$('#apply_start_time,#apply_end_time').val('');
	});
	
	//统计
	$('form').submit(function(){
		$('#search_count').prop('disabled', true);
		$('#loading').show();
		$.post("{:U('CheckOrder/checkStatistics')}", $('form').serialize(), call_back, "json");
		return false;
		function call_back(data){
			if(data.status == 1){
				var html_str = '<tr>' +
					'<td class="taskStatus">' + data.info.shop_name + '</td>' +
					'<td class="taskStatus">' + data.info.is_complain_num + '</td>' +
					'<td class="taskStatus">' + data.info.is_code_num + '</td>' +
					'<td class="taskStatus">' + data.info.order_num + '</td>' +
					'<td class="taskStatus">' + data.info.check_order_num + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_1 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_2 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_3 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_4 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_6 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_5 + '</td>' +
					'<td class="taskStatus">' + data.info.visit_type_7 + '</td>' +
					'<td class="taskStatus">' + data.info.is_pass_num + '</td>' +
					'<td class="taskStatus">' + data.info.activity_name + '</td>' +
					'</tr>';
				$('#null_table').hide();
				$('#count_table').fadeIn(300);
				$('#count_content').html(html_str);
			}else{
				tke_alert(data.info, 'alert-error', 2000);
				$('#count_table').hide();
				$('#null_table').show();
				$('#count_content').html('');
			}
			setTimeout(function(){
				$('#loading').hide();
				$('#search_count').prop('disabled', false);
			}, 1000);
		}
	});
	
	//日期控件
	$(".datepicker").datetimepicker({
		format: 'yyyy-mm-dd hh:ii', 
	    autoclose: true,
	    todayBtn: true
	});
	
});

//导航高亮
highlight_subnav("{:U('CheckOrder/checkStatistics')}");
</script>
</block>